﻿using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Logging;

namespace DotNetStar.TheKing.Domain.EventHandlers
{
    public class EventHandlerBase<TEventHandler>
        where TEventHandler:EventHandlerBase<TEventHandler>
    {
        private ILoggerFactory _loggerFactory;
        protected EventHandlerBase(ILoggerFactory loggerFactory,IMemoryCache memoryCache)
        {
            _loggerFactory = loggerFactory;
            this.Cache = memoryCache;
        }

        public ILogger<TEventHandler> GetLogger => _loggerFactory.CreateLogger<TEventHandler>();

        protected IMemoryCache Cache { get; }
    }
}
